$(function(){
	//1初始化页面
    paging(1);
    //2 绑定查询按钮
    $('.sel_btn').click(function(){
    	paging(1);
    });
    
    //3 绑定重置按钮
    $('.reset_btn').click(function(){
    	$("#personCode").val('');
    	$("#personCode").focus();
    });
    
    
    
});




//查看用户信息
see_func=function(obj){
    var personCode=$(obj).parent().parent().attr('personCode');
    layer.open({
    	extend:['skin/layer_iframe.css'],
        skin:'layer-ext-skin-layer_iframe.css',
        type:2,
        title:'查看用户信息页面',
        area:['600px','400px'],
        content:'lookSysPerson.do?personCode='+personCode,
        maxmin: true,
        shadeClose: true
    });
}



//分页，初始化数据
function paging(pageNo) {
	var pageSize = $("#pageSize  option:selected").text();
    var personCode = $("#personCode").val();

    $.ajax({
        url: "pagingOperationLogList.do",
        type: "post",
        dataType: 'json',
        data: {
        	"iPageSize": pageSize,
            "iPageNo": pageNo,
            "personCode": personCode
        },
        error: function (data) {
        	layer.msg('出错了！！',{time:2000});
        },
        success: function (jsons) {
            if (jsons != null) {
                $("#pageTable").html("");
                var pageList = jsons.pageData.pageList;
                for (var i = 0; i < pageList.length; i++) {
                    var partsForm =
                        '<tr personCode="'+pageList[i].personCode +'">' +
                        //'<td title=' + (pageList[i].logId == null ? '' : pageList[i].logId) + '>' + (pageList[i].logId == null ? '' : pageList[i].logId) + '</td>' +
                        '<td title=' + (pageList[i].personCode == null ? '' : pageList[i].personCode) + '>' + (pageList[i].personCode == null ? '' : pageList[i].personCode) + '</td>' +
                        '<td title=' + (pageList[i].requestIp == null ? '' : pageList[i].requestIp) + '>' + (pageList[i].requestIp == null ? '' : pageList[i].requestIp) + '</td>' +
                        '<td title=' + (pageList[i].operation == null ? '' : pageList[i].operation) + '>' + (pageList[i].operation == null ? '' : pageList[i].operation) + '</td>' +
                        '<td title=' + (pageList[i].sessionId == null ? '' : pageList[i].sessionId) + '>' + (pageList[i].sessionId == null ? '' : pageList[i].sessionId) + '</td>' +
                        '<td title=' + (pageList[i].operationDate == null ? '' : pageList[i].operationDate) + '>' + (pageList[i].operationDate == null ? '' : pageList[i].operationDate) + '</td>' +
                        '<td title=' + (pageList[i].information == null ? '' : pageList[i].information) + '>' + (pageList[i].information == null ? '' : pageList[i].information) + '</td>' +
                        '<td>'+
                        '<i class="See content_current see_btn" title="查看用户信息"></i>' +
                        '</td>' +
                        '</tr>';
                    $(partsForm).appendTo("#pageTable");
                }
                $('.see_btn').click(function(){
                    see_func(this);
                });
                //处理footer 分页
                var totalCount = jsons.pageData.totalCount;
                var pageSize = jsons.pageData.pageSize;
                var totalPage = jsons.pageData.totalPage;
                var pageNo = jsons.pageData.pageNo;
                dealFooterPage(totalCount, pageSize, totalPage, pageNo);
            }
        }
    });
}
